home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / intro / results < prev    next >
Encoding:
Text File  |  1992-12-17  |  3.8 KB  |  64 lines

  1.      COMMAND RESULTS
  2.           Each command produces two results:  a  code  and  a  string.
  3.           The   code   indicates   whether   the   command   completed
  4.           successfully  or  not,  and  the  string  gives   additional
  5.           information.  The valid codes are defined in tcl.h, and are:
  6.  
  7.                TCL_OK              This is the normal return code, and
  8.                                    indicates    that    the    command
  9.                                    completed successfully.  The string
  10.                                    gives the command's return value.
  11.  
  12.                TCL_ERROR           Indicates that an  error  occurred;
  13.                                    the    string   gives   a   message
  14.                                    describing the error.  In  additon,
  15.                                    the  global variable errorInfo will
  16.                                    contain human-readable  information
  17.                                    describing   which   commands   and
  18.                                    procedures were being executed when
  19.                                    the  error occurred, and the global
  20.                                    variable  errorCode  will   contain
  21.                                    machine-readable  details about the
  22.                                    error, if they are available.   See
  23.                                    the   section   BUILT-IN  VARIABLES
  24.                                    below for more information.
  25.  
  26.                TCL_RETURN          Indicates that the  return  command
  27.                                    has  been  invoked,  and  that  the
  28.                                    current  procedure  (or   top-level
  29.                                    command  or  source command) should
  30.                                    return  immediately.   The   string
  31.                                    gives  the  return  value  for  the
  32.                                    procedure or command.
  33.  
  34.                TCL_BREAK           Indicates that  the  break  command
  35.                                    has  been invoked, so the innermost
  36.                                    loop should abort immediately.  The
  37.                                    string should always be empty.
  38.  
  39.                TCL_CONTINUE        Indicates that the continue command
  40.                                    has  been invoked, so the innermost
  41.                                    loop  should  go  on  to  the  next
  42.                                    iteration.    The   string   should
  43.                                    always be empty.
  44.           Tcl programmers do not normally need to think  about  return
  45.           codes,  since TCL_OK is almost always returned.  If anything
  46.           else is returned by a  command,  then  the  Tcl  interpreter
  47.           immediately  stops  processing  commands  and returns to its
  48.           caller.  If there are several nested invocations of the  Tcl
  49.           interpreter  in  progress,  then  each  nested  command will
  50.           usually return the error to its caller, until eventually the
  51.           error  is  reported  to the top-level application code.  The
  52.           application will then display  the  error  message  for  the
  53.           user.
  54.  
  55.           In a few cases, some commands will handle certain  ``error''
  56.           conditions  themselves  and  not  return  them upwards.  For
  57.           example, the for command checks for the TCL_BREAK  code;  if
  58.           it occurs, then for stops executing the body of the loop and
  59.           returns TCL_OK to its caller.  The for command also  handles
  60.           TCL_CONTINUE  codes  and  the  procedure interpreter handles
  61.           TCL_RETURN codes.  The catch command allows Tcl programs  to
  62.           catch  errors  and  handle  them  without  aborting  command
  63.           interpretation any further.
  64.